package com.c2soft.ncmx.exch.dao;

import javax.sql.DataSource;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;

//import com.c2soft.ncmx.exch.pojo.Order;
import com.c2soft.ncmx.exch.pojo.OrderBookEntry;

//import com.c2soft.nepalcmx.command.OrderCommand;

public class TradeMgmtDAO {

	@Autowired
	private DataSource dataSource;

	private JdbcTemplate jdbcTemplate;
	
	public void saveTradeService(OrderBookEntry buyOrder,
			OrderBookEntry sellOrder, long price, int qty) {
		String sql = "INSERT INTO CORE_TRADE (tradeId,symbol,buyOrderId,sellOrderId,quantity,price,TradeTime) VALUES (?,?,?,?,?,?,?)";
		jdbcTemplate = new JdbcTemplate(dataSource);
		jdbcTemplate.update(sql,
				new Object[] {1,sellOrder.getSymbol(), buyOrder.getOrderId(),
						sellOrder.getOrderId(), qty, price,System.currentTimeMillis()});
	}

	/*public void saveSellService(OrderCommand sellOrder) {
		String sql = "INSERT INTO ORDERMGMT (type,insname, symbol, qt,ql,qw,price,tp, USER_ID) VALUES (?,?, ?, ?,?,?,?,?,?)";
		jdbcTemplate = new JdbcTemplate(dataSource);
		jdbcTemplate.update(sql,
				new Object[] { "SELL",sellOrder.getInsname(), sellOrder.getSymbol(),
				sellOrder.getQt(), sellOrder.getQl(), sellOrder.getQw(),
				sellOrder.getPrice(), sellOrder.getTp(), sellOrder.getUserId() });
	}*/
	
}
